package com.ck.js;

import cn.hutool.core.io.FileUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import org.junit.jupiter.api.Test;

import java.io.File;

public class Js {

    @Test
    public void test(){
        String url = "https://mtp.creditcard.ecitic.com/citiccard/mtp-locallife-app/goods/sku-info?skuId=37202106181462843725";
        File file = new File("C:\\Users\\timiv\\Desktop\\log.txt");
        while (true){
            String s = HttpUtil.get(url);
            System.out.println(s);
            JSONObject jsonObject = JSONUtil.parseObj(s);
            String buyFlag = jsonObject.getJSONObject("data").getStr("buyFlag");
            FileUtil.appendString(s,file,"utf-8");
        }

    }
}
